<?php
/*************************
* ATTENTION:             *
* CODE IS INCOMPLETE !!! *
*************************/
?>
<?php
global $Config;
require_once($Config->WebCMSRoot.'Base/Control.php');
require_once($Config->WebCMSRoot.'Views/Slideshow.php');
require_once($Config->WebCMSRoot.'Models/Slideshow.php');
require_once($Config->WebCMSRoot.'Models/Image.php');

Class Slideshow extends BaseControl
{
	var $slideshow;
	var $view;

	var $currentPage;
	
	function Slideshow($parameters, &$page)
	{
		$this->slideshow = new SlideshowModel();
		$this->view = new SlideshowView();
		
		parent::BaseControl($parameters, &$page);
	}

	function Execute()
	{
		switch (true)
		{
			case $this->ParameterExists('page') || $this->ParameterExists('key'):
				$this->slideshow->Retrieve($this->parameters);
				break;
		}
//exit;
		
		if ($this->ParameterExists('show'))
		{
	
//print('<pre>' . var_export($this->parameters, true) . '</pre>');//exit;
	
			switch ($this->GetParameter('show'))
			{
				case 'slideshow':
//print('<pre>' . var_export($this, true) . '</pre>');exit;
					$this->view->ShowSlideshow(&$this->slideshow);
					break;
/*
				case 'gallery':
					$this->foto->Retrieve($this->parameters);
//print('<pre>' . var_export($this->foto, true) . '</pre>');exit;
					$this->view->ShowGallery(&$this->foto, $this->GetParameter('page'), $this->GetParameter('count'), $this->GetParameter('fotosPerRow'));
					break;

				case 'pager':
					$this->foto->Retrieve($this->parameters);
					$this->foto->Voorstelling = new VoorstellingModel();
//print('<pre>'.var_export($this->foto, true).'</pre>');exit;
					$parVoorstelling = array('id' => array($this->foto->VoorstellingID));
//print('<pre>'.var_export($parVoorstelling, true).'</pre>');exit;
//print('<pre>'.var_export($this->foto->Voorstelling, true).'</pre>');
					$this->foto->Voorstelling->Retrieve(&$parVoorstelling);
//print('<pre>'.var_export($this->foto->Voorstelling, true).'</pre>');exit;
					$this->view->ShowPager(&$this->foto, $this->GetParameter('page'), $this->GetParameter('count'), $this->GetParameter('flag'));
					break;
*/
			}
		}

		parent::Execute();
	}

	function ValidateArguments()
	{
		$valid = true;
/*
//print('<pre>' . var_export($this->parameters, true) . '</pre>');exit;
		switch (true)
		{
			case $this->ParameterExists('page'):
				$valid = (count($this->parameters) >= 5 && count($this->parameters) <= 6);
				break;
			default:
				$valid = (count($this->parameters) == 4);
				break;
		}
//print('<pre>' . var_export($valid, true) . '</pre>');exit;
*/
		return $valid;
	}
}
?>